#include "test_for_sizeof.h"

char s[257];

/**
 * @brief (&(s) + 1) 其中 +1 表示指向 s 的末尾地址的下一个地址
 */
char* ptr = (char* )(&(s) + 1);

void test_for_sizeof(void)
{
    printf("\r\ntest_for_sizeof: \r\n");
    printf("address of arr is %p\r\n",s);
    printf(LIGHT_CYAN "address of ptr is %p\r\n" NONE,ptr);

    /*使用自行实现的sizeof函数，检测变量占据空间字节大小*/
    size_t aa = sizeof_v(s);

    printf("sizeof s is %d\r\n",aa);

    /*使用自行实现的sizeof函数，检测基本类型的占据空间字节大小*/
    printf("sizeof char is %d\r\n",sizeof_t(char));
    printf("sizeof unsigned char is %d\r\n",sizeof_t(unsigned char));
    printf("sizeof unsigned int is %d\r\n",sizeof_t(unsigned int));
    printf("sizeof unsigned long is %d\r\n",sizeof_t(unsigned long));
    printf("sizeof unsigned long long is %d\r\n",sizeof_t(unsigned long long));
    printf("sizeof float is %d\r\n",sizeof_t(float));
    printf("sizeof double is %d\r\n",sizeof_t(double));
}

